<?php
/**
 * Created by PhpStorm.
 * User: yangt
 * Date: 2020/2/19
 * Time: 22:14
 */

namespace app\survey\controller;

class Type extends SurveyHome {

	public function index($name='survey',$category_id=0){

		$type_info = model('survey/surveyType')->getByName($name);
		if(empty($type_info)){
			$this->error('参数错误');
		}
		$category_list = model('survey/surveyCategory')->where('type_id',$type_info['id'])->where('status',1)->select();

		$survey_list = model('survey')->where('category_id',$category_id)->where('status',1)->where('code','<>',null)->select();

		return $this->fetch('',[
			'type_info'=>$type_info,
			'category_list'=>$category_list,
			'survey_list'=>$survey_list,
			'category_id'=>$category_id
		]);
	}
}